import addWatermark
import recursiveFileList
import re

if __name__ == "__main__":
    config = {
        'source_dir': 'F:\\微信公众号\\Proteus 8.17.zip',
        'output_dir': 'F:\\微信公众号-影子\\Proteus 8.17.zip',
        'watermark_type': 'text',
        'watermark_content': '微信公众号：软件联盟 Software Union',
        'position': ('center', 'center'),
        'margin': 20,
        'opacity': 255,  # 调整为 0-255，255 表示完全不透明
        'text_config': {
            'font_path': 'C://Windows//Fonts//msyh.ttc',
            'font_size': 30,
            'color': (255, 0, 0)  # 纯红色
        },
        'rotation': -30
    }

    folder_name_erjimuluming = '微信公众号'
    folder_name_erjimuluming_shadow = '微信公众号-影子'
    folder_path = "F:\\" + folder_name_erjimuluming # 修改为你的文件夹路径
    files = recursiveFileList.get_all_files(folder_path)
    
    print("获取到的文件夹列表:")
    for file in files:
        print(file)
        new_file = re.sub(r"\b" + folder_name_erjimuluming + r"\b", folder_name_erjimuluming_shadow, file)
        print(new_file)
        config['source_dir'] = file;
        config['output_dir'] = new_file;
        watermarker = addWatermark.Watermarker(config)
        watermarker.process_all()